package app.imttf.internal.backing.admin.role;

import oracle.adf.view.rich.event.DialogEvent;

import app.imttf.internal.adfextensions.ADFUtils;

import app.imttf.internal.backing.utils.BackingUtil;

import oracle.adf.model.BindingContext;
import oracle.adf.view.rich.component.rich.data.RichTable;

import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;


public class HandlePopUpDialog {

    private RichTable childTable;

    public HandlePopUpDialog() {
    }

    public void setChildTable(RichTable childTable) {
        this.childTable = childTable;
    }

    public RichTable getChildTable() {
        return childTable;
    }

    public void confirmDeleteClientDialogListener(DialogEvent e) {
        BackingUtil.confirmDeleteDialogListener(e, getChildTable(),
                                                "RolesView1");
        ADFUtils.invokeEL("#{bindings.Commit.execute}");
    }

/*    public void confirmDelete(DialogEvent dialogEvent) {
        // Add event code here...
        System.out.println("First");
        BackingUtil.confirmDeleteDialogListener(dialogEvent, getChildTable(),
                                                "RolesView1");
        ADFUtils.invokeEL("#{bindings.Commit.execute}");
        System.out.println(dialogEvent.getOutcome());
        System.out.println("Second");
        
                 if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok)) {
            BindingContext bindingctx = BindingContext.getCurrent();
            BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
            OperationBinding operationBinding =
                bindings.getOperationBinding("Commit");
            Object result = operationBinding.execute();
            System.out.println("IFFFF");
        }
        System.out.println("Test :" + dialogEvent.getOutcome()); 
    }*/
}
